import leancloud
appid = "36DGWEWWQpmhKe5Ou59Egeoe-gzGzoHsz"
#appkey = "bexKiLRWoIJqi3ET3hRkkvVH"
#leancloud.init(appid, appkey)
master = 'Jp0KUtb9e4Ijj0ur7ifROhG4'
leancloud.init(appid,master_key=master)
class GetApi:
    def getTeacher(self):
        TeacherInfo = leancloud.Object.extend('TeacherInfo')
        return TeacherInfo
    def getLesson(self):
        Lesson = leancloud.Object.extend('Lesson')
        return Lesson
    def getDictionary(self):
        Dictionary = leancloud.Object.extend('Dictionary')
        return Dictionary
    def getStudent(self):
        student = leancloud.Object.extend('StudentInfo')
        return student
    def getClass(self):
        classinfo = leancloud.Object.extend('ClassInfo')
        return classinfo
    def addUsertea(self,id,name):

        team = self.getTeacher()
        tea = team.create_without_data(id)
        User = leancloud.Object.extend('_User')()
        User.set('TeacherInfo',tea)
        User.set('username',name)
        User.set('password',name)
        try:
            User.save()
        except Exception as e:
            print e.message
    def delUsertea(self,teacher):
        query = leancloud.Query('_User')
        query.equal_to('TeacherInfo',teacher)
        try:
            for foo in query.find():
                foo.destroy()

        except Exception as e:
            print e.message
    def getAdmin(self):
        Admin = leancloud.Object.extend('AdminInfo')
        return Admin 
    def getRollCall(self):
        RollCall = leancloud.Object.extend('RollCall')
        return RollCall
    def getRollCallInfo(self):
        rollcallinfo = leancloud.Object.extend('RollCallInfo')
        return rollcallinfo
    def getNews(self):
        press = leancloud.Object.extend('News')
        return press
    def getMMD(self):
        mmd = leancloud.Object.extend('MMD')
        return mmd
    def getAcademyActity(self):
        aa = leancloud.Object.extend('AcademyActivity')
        return aa
    def getElection(self):
        e = leancloud.Object.extend('Election')
        return e
    def getElectioninfo(self):
        ei = leancloud.Object.extend('ElectionInfo')
        return ei
    def getConservation(self):
        ct = leancloud.Object.extend('_Conversation')
        return ct

    
